package logic

import (
	"context"

	"mall/service/backend/rmq/internal/config"
	kqMq "mall/service/backend/rmq/internal/logic/kq"
	"mall/service/backend/rmq/internal/svc"

	"github.com/zeromicro/go-queue/kq"
	"github.com/zeromicro/go-zero/core/service"
)

// pub sub use kq (kafka)
func KqMqs(c config.Config, ctx context.Context, svcContext *svc.ServiceContext) []service.Service {
	return []service.Service{
		kq.MustNewQueue(c.DeferedUpdateCart, kqMq.NewDeferedUpdateCartMq(ctx, svcContext)),
		kq.MustNewQueue(c.DeferedUpdateTradeState, kqMq.NewDeferedUpdateTradeStateMq(ctx, svcContext)),
		kq.MustNewQueue(c.DeferredCreateGorseItem, kqMq.NewDeferredCreateGorseItemMq(ctx, svcContext)),
		kq.MustNewQueue(c.DeferredUnFreezePointCoupon, kqMq.NewDeferedUnFreezePointCouponMq(ctx, svcContext)),
		// 监听消费流水状态变更
		// Listening for changes in consumption flow status
		kq.MustNewQueue(c.PaymentUpdateTradeState, kqMq.NewThirdPartPaymentUpdateTradeStateMq(ctx, svcContext)),
		kq.MustNewQueue(c.PaymentRefund, kqMq.NewThirdPartPaymentRefundMq(ctx, svcContext)),
		//.....
		kq.MustNewQueue(c.AttachmentSyncQiniu, kqMq.NewAttachmentSyncQiniuMq(ctx, svcContext)),
		kq.MustNewQueue(c.DeferredInquireAi, kqMq.NewDeferredInquireAiMq(ctx, svcContext)),
		//积分发放-扣减-公用
		kq.MustNewQueue(c.DistributePoints, kqMq.NewDistributePointsMq(ctx, svcContext)),
		//上传发货信息至微信后台（微信会通知用户）
		kq.MustNewQueue(c.UploadShipmentInfo, kqMq.NewUploadShipmentInfoToWeBackendMq(ctx, svcContext)),
	}
}
